﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="admin_question_add.aspx.cs" Inherits="skvote.admin_question_add" %>

<%@ Import Namespace="System.Data.OleDb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<%skvote.function.header(Response);%>
<title>【单考投票系统】后台管理中心</title>
</head>
<body>
<table border="0" cellpadding="1" cellspacing="2" width="100%" id="table1" bgcolor="#E1F0FF">
  <tr>
    <td><table width="100%" id="table2" cellspacing="1">
        <tr>
          <td id="TableTitle1"> 添加投票答案-&gt;</td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><table border="1" cellpadding="4" cellspacing="0" width="100%" id="table2" bordercolor="#BFDFFF">

        <form action="" name="form3" method="post" id="form1" runat="server">
          <tr id="TableTitle2">
            <td align="center" colspan="2" bgcolor="#BFDFFF"><b>设置投票答案</b></td>
          </tr>
          <tr>
            <td align="right">选择投票问题：</td>
            <td><select name="tid" id="tid">
                <%
                    OleDbConnection connection = new skvote.conn().CreateConnection();
                    try
                    {
                        connection.Close();
                        connection.Open();
                        OleDbCommand cmd = new OleDbCommand("select * from xh_subject order by id desc", connection);
                        OleDbDataReader dr = cmd.ExecuteReader();
                        while (dr.Read())
                        {
                            Response.Write("<optgroup label='" + dr["subject"].ToString() + "'>");
                            OleDbConnection tempconn = new skvote.conn().CreateConnection();
                            try
                            {
                                OleDbCommand tempcmd = new OleDbCommand("select * from xh_title where sid=" + dr["id"].ToString(), tempconn);
                                OleDbDataReader tempdr = tempcmd.ExecuteReader();
                                while (tempdr.Read())
                                {
                                    Response.Write("<option value='" + tempdr["id"].ToString() + "'>" + tempdr["title"].ToString() + "</option>");
                                }
                                tempdr.Close();
                                tempcmd.Dispose();
                            }
                            finally
                            {
                                tempconn.Close();
                            }
                            Response.Write("</optgroup>");
                        }
                        dr.Close();
                        cmd.Dispose();
                    }
                    finally
                    {
                        connection.Close();
                    }
                %>
                </select>
            </td>
          </tr>
          <tr>
            <td width="40%" align="right">投票答案名称：</td>
            <td><input type="text" name="question" size="25" id="question">
            </td>
          </tr>
          <tr>
            <td width="40%" align="right">票数：</td>
            <td><input type="text" name="ps" size="5" value="0" id="ps"></td>
          </tr>
          <tr>
            <td colspan="2" align="center"><asp:Button ID="submit" Text="完成" runat="server" 
                    CssClass="btn" onclick="submit_Click" /></td>
          </tr>
        </form>
      </table></td>
  </tr>
</table>
</body>
</html>